var oDiv=document.getElementById("lis").children;
for( var i=0; i<oDiv.length;i++) {
    oDiv[0].index=true;
    oDiv[i].onmouseover = function () {
        this.getElementsByTagName("div")[0].style.display = "block";
        this.getElementsByTagName("p")[0].style.display = "block";
        this.getElementsByTagName("img")[5].style.display = "block";
        this.getElementsByTagName("div")[0].onclick = function () {

            for (var j = 0; j < oDiv.length; j++) {
                oDiv[j].style.opacity = "0.5";
                oDiv[j].index = false;
                oDiv[j].getElementsByTagName("div")[0].style.display = "none";
                oDiv[j].getElementsByTagName("p")[0].style.display = "none";
                oDiv[j].getElementsByTagName("img")[5].style.display = "none";
                oDiv[j].getElementsByTagName("div")[0].innerHTML = "设置默认";
            }
            this.innerHTML = "默认地址"
            this.parentNode.index = true;
            this.parentNode.style.opacity = "1";
            this.parentNode.getElementsByTagName("p")[0].style.display = "block";
            this.parentNode.getElementsByTagName("img")[5].style.display = "block";


        }
        for( var j=0;j<oDiv.length;j++) {
            oDiv[j].getElementsByTagName("a")[1].onclick = function () {

                if(confirm("确定要删除吗？"))
                    this.parentNode.parentNode.style.display = "none";
            }

        }

    }


    oDiv[i].onmouseout=function(){
        if(!this.index) {
            this.getElementsByTagName("div")[0].style.display = "none";
            this.getElementsByTagName("p")[0].style.display = "none";
            this.getElementsByTagName("img")[5].style.display = "none";
        }
    }
}

var oInput=document.getElementById("city").getElementsByTagName("input");
var oFo=document.getElementById("tab");
var oUl=oFo.getElementsByTagName("ul");
for( var i=0;i<oInput.length;i++) {

    oInput[i].index = i;
    oInput[i].onclick = function () {
        for( var j=0;j<oInput.length;j++){
            oInput[j].style.backgroundColor="#ffffff";
            oUl[j].style.display="none";
        }
        change(oUl[this.index], this.index);
        oUl[this.index].style.display = "block";
        this.style.backgroundColor = "#cccccc";
    }
}
function change(obj,n) {
    var oLi = obj.getElementsByTagName("li");
    for (var j = 0; j < oLi.length; j++) {
        oLi[j].onmouseover = function () {
            this.style.fontSize = "15px";
        }
        oLi[j].onmouseout = function () {
            this.style.fontSize = "13px";
        }
        oLi[j].onclick = function () {
            for (var j = 0; j < oLi.length; j++) {
                oLi[j].getElementsByTagName("span")[0].style.color="#cccccc";
            }
            this.getElementsByTagName("span")[0].style.color="blue";
            oInput[n].value = this.getElementsByTagName("i")[0].innerHTML;
            oInput[n].style.backgroundColor = "#ffffff";
            oInput[n].style.color = "#000000"
            this.parentNode.style.display = "none";


        }
    }
}
//点击编辑
var oNav=document.getElementsByClassName("nav")[0];
var oCh=document.getElementsByClassName("newadd")[0];
var oLs=document.getElementsByClassName("ls");
var oAdd=document.getElementsByClassName("address")[0];
var oRight=document.getElementById("right");
for( var a=0;a<oLs.length;a++) {
    oLs[a].getElementsByTagName("a")[0].onclick=function(){
        var oSpan=this.parentNode.parentNode.getElementsByTagName("span");
        oCh.style.display="block";
        oAdd.style.backgroundColor="rgba(185,185,185,0.5)";
        oNav.style.backgroundColor="rgba(255,255,255,0)";
        oRight.style.backgroundColor="rgba(255,255,255,0)";
        var oBtn=document.getElementsByClassName("p5");
        oBtn[0].onclick=function(){
            oCh.style.display="none";
            oAdd.style.backgroundColor="#f5f5f5";
            oNav.style.backgroundColor="rgba(255,255,255)";
            oRight.style.backgroundColor="rgba(255,255,255)";
            var oValue=document.getElementsByClassName("t1");
            var oT1=document.getElementById("t5");
            var index1=oT1.selectedIndex ;
            var oT2=document.getElementById("t6");
            var index2=oT2.selectedIndex ;
            var oT3=document.getElementById("t7");
            var index3=oT3.selectedIndex ;
            if(oValue[0].value!=0){
            oSpan[0].innerHTML=oValue[0].value;}
            if(oValue[1].value!=0){
            oSpan[1].innerHTML=oValue[1].value;}
            oSpan[3].innerHTML=oT1.options[index1].text;
            oSpan[4].innerHTML=oT2.options[index2].text;
            oSpan[5].innerHTML=oT3.options[index3].text;
            if(textear2.value!=0){
            oSpan[6].innerHTML=textear2.value;
            }
        }
        oBtn[1].onclick=function(){
            oCh.style.display="none";
            oAdd.style.backgroundColor="#f5f5f5";
            oNav.style.backgroundColor="rgba(255,255,255)";
            oRight.style.backgroundColor="rgba(255,255,255)";

        }
    }

}






